﻿using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using ZeroAdmin.Application;

namespace ZeroAdmin.Web.Core;

/// <summary>
/// 认证服务
/// </summary>
[ApiDescriptionSettings(Name = "Auth", Order = 100, Tag = "认证服务")]
[AllowAnonymous]
public class AuthController(IAuthService service) : IDynamicApiController
{
    private readonly IAuthService _service = service;

    /// <summary>
    /// 登入
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<LoginOutput> Login(LoginInput input)
    {
        return await _service.Login(input);
    }

    /// <summary>
    /// 登出
    /// </summary>
    public void Logout()
    {
        _service.Logout();
    }
}
